home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / share / dos / graficos / plydat14.arj / ALLPRIMS.PI next >
Encoding:
Text File  |  1992-04-08  |  6.3 KB  |  245 lines

  1. // Sample file demonstrating all (well almost all) of the primitives that
  2. // exist in Polyray.
  3. // Author - Alexander Enzmann
  4.  
  5. viewpoint {
  6.    from <0,150,-200>
  7.    at <0,0,0>
  8.    up <0,1,0>
  9.    angle 8.5
  10.    resolution 360, 275 // 720, 450
  11.    aspect 1.6
  12.    }
  13.  
  14. background midnightblue
  15.  
  16. bounding_slab <1, 0, 0>
  17. bounding_slab <0, 1, 0>
  18. bounding_slab <0, 0, 1>
  19.  
  20. light <0.3, 0.3, 0.3>, <0, 50, 0>
  21. spot_light white, < 20, 10, -20>, < 15,0,-15>, 5, 40, 42
  22. spot_light white, <-20, 10, -20>, <-15,0,-15>, 5, 40, 42
  23.  
  24. include "colors.inc"
  25. include "texture.inc"
  26.  
  27. // In alphabetical order even...
  28.  
  29. // Start with some flags so we can turn the individual
  30. // objects on and off.  This is real useful during
  31. // testing.
  32. define blob_flag       1
  33. define box_flag        1
  34. define cone_flag       1
  35. define cylinder_flag   1
  36. define disc_flag       1
  37. define function_flag   0
  38. define height_flag     1
  39. define lathe_flag      1
  40. define parabola_flag   1
  41. define polygon_flag    1
  42. define polynomial_flag 1
  43. define sweep1_flag     1
  44. define sweep2_flag     1
  45. define sphere_flag     1
  46. define torus_flag      1
  47.  
  48. if (blob_flag == 1)
  49. // Start with a multipoint blob.  This blob is carved from white
  50. // marble.
  51. object {
  52.    blob 0.5:
  53.       1.0, 1.0, <0.75, 0, 0>,
  54.       1.0, 1.0, <0.75*cos(radians(120)), 0.75*sin(radians(120)), 0>,
  55.       1.0, 1.0, <0.75*cos(radians(240)), 0.75*sin(radians(240)), 0>,
  56.       1.0, 1.0, <0.2, 1.2, 0.8>,
  57.       1.0, 1.0, <-0.2, 1.2, -0.8>,
  58.       1.0, 1.0, <0.3, -1, -0.7>,
  59.       1.0, 1.0, <0, 0, 0>,
  60.       1.0, 1.0, <-0.1, 0, 0.3>,
  61.       1.0, 1.0, <0,-2, -0.5>,
  62.       1.0, 1.0, <-0.5, -1, -1.4>
  63.    u_steps 20
  64.    v_steps 20
  65.    white_marble
  66.    translate <0, 2, 0>
  67.    scale <1.5, 1, 2>
  68.    rotate <0, 80, 0>
  69.    translate <-12, 0, -20>
  70.    }
  71.  
  72. if (box_flag == 1)
  73. // Box primitive
  74. object {
  75.    box <-2, 0,-2>, <2, 2, 2>
  76.    rotate <40, 30, 0>
  77.    translate <-5, 3, 16>
  78.    matte_blue
  79.    }
  80.  
  81. if (cone_flag == 1)
  82. // Cone primitive
  83. object {
  84.    cone <0, 0, 0>, 3, <0, 6, 0>, 0
  85.    translate <8, 0, 16>
  86.    reflective_gold
  87.    }
  88.  
  89. if (cylinder_flag == 1)
  90. // A Cylinder that has an image wrapped around it
  91. object {
  92.    cylinder <0, 0, 0>, <0, 6, 0>, 3
  93.    texture {
  94.       special surface {
  95.          color cylindrical_imagemap(image("cylimg.tga"), P, 1)
  96.          ambient 0.5
  97.          diffuse 0.5
  98.          }
  99.       scale <1, 6, 1>
  100.       }
  101.    rotate <0,-90, 0>
  102.    translate <-20, 0, 0>
  103.    }
  104.  
  105. if (disc_flag == 1)
  106. // Disc primitive.  These are so boring by themselves that
  107. // I've added some ripple to the surface just to make it
  108. // a little more interesting.
  109. object {
  110.    disc <0, 0, 0>, <0, 1, 0>, 4
  111.    blue_ripple
  112.    rotate <-20, -30, 0>
  113.    translate <-5, 3, -10>
  114.    }
  115.  
  116. if (height_flag == 1)
  117. object {
  118.    height_fn 20, 20, -4, 4, -4, 4,
  119.       4 * cos(3 * sqrt(x^2 + z^2)) * exp(-0.5 * sqrt(x^2 + z^2))
  120.    shiny_green
  121.    translate <15, 2, -10>
  122.    }
  123.  
  124. if (function_flag == 1)
  125. // Implicit function.  This surface is nice and wavy.
  126. // It is small in this image cause these things take
  127. // forever to render.
  128. object {
  129.    function y - 0.25 * sin(18.85 * x * z)
  130.    shiny_red
  131.    bounds object { sphere <0,0,0>, 2 }
  132.    scale <4, 4, 4>
  133.    translate <-15, 0, -10>
  134.    }
  135.  
  136. if (lathe_flag == 1)
  137. // Lathe primitive
  138. object {
  139.    lathe 2, <0, 1, 0>, 5,
  140.         <3, 0>, <0.5, 2>, <4, 3>, <3, 7>, <0, 9>
  141.    scale <0.8, 0.8, 0.8>
  142.    shiny_coral
  143.    translate <0, 0, 8>
  144.    }
  145.  
  146. if (parabola_flag == 1)
  147. // Parabola primitive.  Sort of like a salt shaker in this
  148. // orientation.
  149. object {
  150.    parabola <0, 6, 0>, <0, 0, 0>, 3
  151.    translate <16, 0, 16>
  152.    steel_blue
  153.    }
  154.  
  155. if (polynomial_flag == 1)
  156. // Polynomial surface.  This is the devils curve, one of
  157. // my personal favorites.
  158. object {
  159.    polynomial x^4 + 2*x^2*z^2 - 0.36*x^2 - y^4 + 0.25*y^2 + z^4
  160.    bounds object { sphere <0, 0, 0>, 3 }
  161.    clips  object { box <-2, -2, -0.5>, <2, 2, 0.5> }
  162.    scale <2, 2, 2>
  163.    rotate <20, 10, 0>
  164.    shiny_red
  165.    translate <-15, 4, -10>
  166.    }
  167.  
  168. if (sphere_flag == 1)
  169. // Create a sphere with a checker texture
  170. object {
  171.    sphere <0, 0, 0>, 3
  172.    texture {
  173.       checker shiny_red, shiny_blue
  174.       }
  175.    translate <-15, 3, 16>
  176.    }
  177.  
  178. // Sweep surfaces - there are several so that the various
  179. // forms can be demonstrated.
  180. define r0 2
  181. define r1 4
  182. define dt (2.0 * 3.14159265) / 14
  183.  
  184. if (sweep1_flag == 1)
  185. // First sweep is made from connected line segments
  186. object {
  187.    sweep 1, <0, 1, 0>, 15,
  188.          <r0*cos( 1*dt), r0*sin( 1*dt)>, <r1*cos( 2*dt), r1*sin( 2*dt)>,
  189.          <r0*cos( 3*dt), r0*sin( 3*dt)>, <r1*cos( 4*dt), r1*sin( 4*dt)>,
  190.          <r0*cos( 5*dt), r0*sin( 5*dt)>, <r1*cos( 6*dt), r1*sin( 6*dt)>,
  191.          <r0*cos( 7*dt), r0*sin( 7*dt)>, <r1*cos( 8*dt), r1*sin( 8*dt)>,
  192.          <r0*cos( 9*dt), r0*sin( 9*dt)>, <r1*cos(10*dt), r1*sin(10*dt)>,
  193.          <r0*cos(11*dt), r0*sin(11*dt)>, <r1*cos(12*dt), r1*sin(12*dt)>,
  194.          <r0*cos(13*dt), r0*sin(13*dt)>, <r1*cos(14*dt), r1*sin(14*dt)>,
  195.          <r0*cos( 1*dt), r0*sin( 1*dt)>
  196.    translate <0, 0, -20>
  197.    matte_red
  198.    }
  199.  
  200. if (sweep2_flag == 1)
  201. // Second sweep is made from connected quadratic splines.
  202. object {
  203.    sweep 2, <0, 1, 0>, 16,
  204.       <0, 0>, <0, 1>, <-1, 1>, <-1, -1>, <2, -1>, <2, 3>,
  205.       <-4, 3>, <-4, -4>, <4, -4>, <4, -11>, <-2, -11>,
  206.       <-2, -7>, <2, -7>, <2, -9>, <0, -9>, <0, -8>
  207.    translate <0, 0, -4>
  208.    rotate <0,-45, 0>
  209.    translate <10, 0, -18>
  210.    shiny_yellow
  211.    }
  212.  
  213. if (torus_flag == 1)
  214. // Torus primitive.  Just for grins lets make it out of wood.
  215. object {
  216.    torus sqrt(40), sqrt(12), <0, 0, 0>, <0, 1, 0>
  217.    wooden
  218.    scale <0.3, 0.3, 0.3>
  219.    rotate <-40, 0, 0>
  220.    translate <10, 3, 0>
  221.    }
  222.  
  223. // Make a hexagonal polygon with hexagonal texturing
  224. define rp 30                         // Radius of the polygon
  225. define ang (2.0 * 3.14159265) / 6     // 60 degrees in radians
  226. if (polygon_flag == 1)
  227. object {
  228.    polygon 6,
  229.          <rp*cos( 1*ang), 0, rp*sin( 1*ang)>,
  230.          <rp*cos( 2*ang), 0, rp*sin( 2*ang)>,
  231.          <rp*cos( 3*ang), 0, rp*sin( 3*ang)>,
  232.          <rp*cos( 4*ang), 0, rp*sin( 4*ang)>,
  233.          <rp*cos( 5*ang), 0, rp*sin( 5*ang)>,
  234.          <rp*cos( 6*ang), 0, rp*sin( 6*ang)>
  235.    texture {
  236.       hexagon
  237.          xz_wheel_texture,
  238.          sapphire_agate,
  239.          whorl_texture
  240.       scale <6, 6, 6>
  241.       }
  242.    translate <0, -0.05, 0>
  243.    }
  244.  
  245.